<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>博客详情页</title>
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="css/bolg_detail.css">
       <!-- 引入jquery依赖 -->
  <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
   <!-- 引入 editor.md 的依赖 -->
   <link rel="stylesheet" href="editor.md/css/editormd.min.css" />
   <script src="editor.md/lib/marked.min.js"></script>
   <script src="editor.md/lib/prettify.min.js"></script>
   <script src="editor.md/editormd.js"></script>
</head>
<body>
     <!-- 导航栏,nav是导航的缩写 -->
     <div class="nav">
        <img src="image/OIP-C.jpg" alt=" ">
           <div class="title">我的博客系统</div>
           <!-- 一个空白,把后面链接挤过去 -->
           <!-- 简单粗暴的写法 -->
       <div class="spacer"></div>
           <a href="blog_list.html">主页</a>
          <a href="blog_edit.html">写博客</a>
          <!-- 地址回头再说 -->
          <a href="">注销</a>
       
       </div>
       <div class="container">
        <!-- 左侧信息 -->
        <div class="container-left">
            <!-- 这个div表示整个用户信息的区域 -->
            <div class="card">
                <!-- 用户头像 -->
                <img src="image/OIP-C (1).jpg" alt="">
                <!-- 用户名 -->
                <h3>小魏爱炸毛</h3>
                <a href="https://www.github.com">github地址</a>
                <!-- 统计信息 -->
                <div class="counter">
                    <span>文章</span>
                    <span>分类</span>
                </div>
                <div class="counter">
                    <span>2</span>
                    <span>1</span>
                </div>
            </div>
    
        </div>
        <!-- 右侧信息 -->
        <div class="container-right">
            <h3></h3>
            <div class="date"></div>
            <!--正文用段落-->
            <div id="content">
            
            </div>
        </div>
    </div> 
    <script>
        function getBlog(){
            $.ajax({
                type: 'get',
                url: 'blog'+location.search,
                success: function(body){
                    let h3=document.querySelector('.container-right h3');
                    h3.innerHTML=body.title;

                    let dateDiv=document.querySelector('.container-right .date');
                    dateDiv.innerHTML=body.postTime;
                        //第一个参数是HTML元素的id,由id生成对应页面
                        //markdown渲染
                        //设置正文,正文内容应该是Markdown的内容,不是markdown的原始字符串
                        editormd.markdownToHTML('content',{markdown: body.content});

                }
            });
          
        }  
        getBlog();
    </script>
</body>
</html>